package com.penghaisoft.microwms.material.web.expose.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.penghaisoft.microwms.common.Constant;
import com.penghaisoft.microwms.common.controller.BaseController;
import com.penghaisoft.microwms.common.data.model.MdContract;
import com.penghaisoft.microwms.common.dto.TransResult;
import com.penghaisoft.microwms.common.page.Pager;
import com.penghaisoft.microwms.material.web.expose.service.IMdContractService;
 
/** 
 * @Package com.penghaisoft.microwms.material.web.expose.controller
 * @ClassName: ExposeContractController
 * @Description: 获取合同号
 * @author luoteng
 * @date 2019年4月1日 上午9:26:05
 */
@RestController
@RequestMapping(value = "/expose/contract")
public class ExposeContractController extends BaseController {

	@Autowired
	private IMdContractService iMdContractService;
    
    /** 
     * @Title requisitionNormalAdd
     * @Description 原材料领料单 新增
     * @author luoteng
     * @date 2018年6月19日:下午1:49:19
     * @param list
     * @return HandResp
     */
    @PostMapping("select/get")
    public TransResult getContractNoSelect(@RequestBody MdContract mdContract) {
    	TransResult result = new TransResult();
		mdContract.setActiveFlag("1");
		List<MdContract> list = iMdContractService.queryList(mdContract);
		result.setCode(Constant.SUCCESS);
		result.setList(list);
		return result;
    }
    
    /** 
     * @Title requisitionRepairAdd
     * @Description 原材料领料单 返修 新增
     * @author luoteng
     * @date 2018年6月19日:下午1:49:27
     * @param list
     * @return HandResp
     */
    @PostMapping("page/get")
    public TransResult getContractNoPage(@RequestBody MdContract mdContract) {
        Pager<MdContract> result = iMdContractService.findListByCondition(mdContract.getPage(), mdContract.getRows(), mdContract);
		return success(result);
    }
}
